package com.jwd.mybatis.service

import com.jwd.mybatis.SLoginUser
import com.jwd.mybatis.SRole
import com.jwd.mybatis.SUser
import com.jwd.mybatis.SUserRole
import com.jwd.mybatis.mapper.UserMapper
import org.apache.ibatis.annotations.Param
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

/**
 * Created by udi on 2017.3.6.
 */
@Service
class UserService {
    @Autowired
    var userMapper : UserMapper? = null;

    fun findByLoginName(login_name: String): SUser{
        return userMapper!!.findByLoginName(login_name);
    }

    fun findRolesByUserId(userId:Int): List<SRole> {
            return userMapper!!.findRolesByUserId(userId);
    }

    fun findLoginUserByUserId(userId:Int):SLoginUser{
        return userMapper!!.findLoginUserByUserId(userId);
    }
}